{% extends "base.html" %}

{% load comments %}

{% block left %}
  {% block left.author %}
  <h2>Author:</h2>
  {% if profile.avatar%}
  <a href="/profiles/{{ author.id }}"><img class="avatar" src="{{ author.profile.avatar.url_150x150 }}" /></a>
  {% endif %}
  <ul>
    <li class="name"><a href="/profiles/{{ author.id }}">{{ author.username }}</a></li>
    <li class="title">{{ author.profile.signature }}</li>
    <li class="asset_count">{{ author.profile.nr_of_assets }}</li>
  </ul>
  {% endblock %}
  <br/>
  
  {% block left.extra %}
  {% endblock %}
{% endblock %}


{% block content.bottom %}
  <div class="row">
    <div class="span16">
      <h5>Comments</h5>
      <div style="width: 100%; border: solid 1px #ccc;"></div>
    </div>
  </div>
  {% get_comment_list for resource as comment_list %}
  {% for comment in comment_list %}
    <div class="row">
        <div class="span4">
          {{ comment.user }}
          <a href="{% get_comment_permalink comment "#c%(id)s-by-%(user_name)s"%}">{{ comment.submit_date }}</a>
          {% if comment.user.profile.avatar %}
            <img class="avatar" src="{{ comment.user.profile.avatar.url_150x150 }}" />
          {% endif %}
          {{ comment.user.profile.signature }}
        </div>
        <div class="span12">
          {{ comment.comment }}
          
        </div>
    </div>
    <div class="row">
      <div class="span16">
        <div style="width: 100%; border: solid 1px #ccc; margin-bottom: 20px;"></div>
      </div>
    </div>
  {% endfor %}
  
  {% if user.is_authenticated %}
    {% get_comment_form for resource as form %}
    <div class="row">
          <div class="span4">
            {{ user }}
            {{ user.submit_date }}
            {% if user.profile.avatar %}
              <img class="avatar" src="{{ user.profile.avatar.url_150x150 }}" />
            {% endif %}
            {{ user.profile.signature }}
          </div>
          <div class="span12">
            <form action="{% comment_form_target %}" method="post">
              {% csrf_token %}
              <div style="display: none;">{{ form.honeypot }}</div>
              {{ form.email }}
              {{ form.content_type }}
              {{ form.object_pk }}
              {{ form.timestamp }}
              {{ form.security_hash }}
              
              <input type="hidden" name="next" value="{{ request.path_info }}" />
              
              <div class="clearfix">
                <div class="input1">
                  <textarea id="id_comment" rows="10" class="span12" name="comment"></textarea>
                </div>
              </div>
              
              <div class="actions">
                <input type="submit" class="btn primary" name="submit" value="Post" />&nbsp;
                <input type="submit" class="btn" name="preview" value="Preview" />
              </div>
            </form>
          </div>
      </div>
    {% else %}
      You need to login to comment!
    {% endif %}

{% endblock %}

